<?php

namespace vico\reservarBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class UsuarioType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
										->add('name','text',array(
																												'label'=>'Nombre y Apellidos',
																												'attr'=>array(
																																				'class'=>'form-control',
																													)
																))
										->add('nick','text',array(
																												'label'=>'Nick',
																												'attr'=>array(
																																				'class'=>'form-control',
																													)
																))
										->add('email','email',array(
																												'label'=>'Email',
																												'attr'=>array(
																																				'class'=>'form-control',
																													)
																))
										->add('password','repeated',array(
																												'type'=>'password',
																												'invalid_message'=>'Las contrasena no coincide',
																												'options'=>array(
																															'label'=>'Contraseña',
																															'attr'=>array(
																																				'class'=>'form-control',
																																)
																								)
																))
										->add('role','entity',array(
																		'label'=>'Tipo de Usuario',
																		'class'=>'rsBundle:Role',
																		'attr'=>array(
																																	'class'=>'form-control'	
																									)))							
        //    ->add('salt')
        ;
    }
    
    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'vico\reservarBundle\Entity\Usuario'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'vico_reservarbundle_usuario';
    }
}
